import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

const actions = {
    add(context,value){
        context.commit('ADD',value)
    },
    unadd(context,value){
        context.commit('UNADD',value)
    }
}

const mutations = {
    ADD(state,value){
        state.sum += value
    },
    UNADD(state,value){
        state.sum -= value
    }
}

const state = {
    sum: 0,
    address: '雄飞广场5座',
    job: '前端开发'
}

const getters = {
    BigSum(state){
        return state.sum * 10
    }
}

const store = new Vuex.Store({
    actions,
    mutations,
    state,
    getters
})

export default store